﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using TXTD.Admin.Data.Entitys.System;
using TXTD.Admin.Interface.System;
using TXTD.Admin.Model.Core;

namespace TXTD.Admin.WebApi.Modules.System
{
    [Route("api/System/[controller]")]
    [ApiController]
    public class SysMenuController : ControllerBase
    {
        private ISysMenuService menuService;
        public SysMenuController(ISysMenuService _menuService)
        {
            menuService = _menuService;
        }
        [HttpGet("GetMenuList")]
        public ResultModel GetMenuList()
        {
            return ResultModel.ResultBy(menuService.GetMenuList());
        }
        [HttpPost("Add")]
        public ResultModel Add(SysMenu model)
        {
            throw new Exception("演示版本暂不开放操作菜单功能");
            return ResultModel.ResultByCount(menuService.Add(model));
        }
        [HttpPost("Update")]
        public ResultModel Update(SysMenu model)
        {
            throw new Exception("演示版本暂不开放操作菜单功能");
            return ResultModel.ResultByCount(menuService.Update(model));
        }
        [HttpPost("Delete")]
        public ResultModel Delete(string id)
        {
            throw new Exception("演示版本暂不开放操作菜单功能");
            return ResultModel.ResultByCount(menuService.DeleteById(id));
        }
        /// <summary>
        /// 获取登录用户菜单列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetMenu")]
        public ResultModel GetLoginUserMenuList()
        {
            return ResultModel.ResultBy(menuService.GetLoginUserMenuList());
        }
    }
}